#pragma once

#include "UniBuffer.h"

#define MAX_COMPSTRING_SIZE 256

class CEditBox;

class CIMEDevice
{
public:
	CIMEDevice(CEditBox* editbox);
	~CIMEDevice(void);

	void Init(HWND hWnd);

	virtual void OnInputLangChange(WPARAM wParam, LPARAM lParam);
	virtual void OnChar(WPARAM wParam, LPARAM lParam);
	virtual void OnStartComposition(WPARAM wParam, LPARAM lParam);
	virtual void OnComposition(WPARAM wParam, LPARAM lParam);
	virtual void OnEndComposition(WPARAM wParam, LPARAM lParam);
	virtual void OnNotify(WPARAM wParam, LPARAM lParam);

	bool MsgProc( UINT message, WPARAM wParam, LPARAM lParam );

	HWND GetHandle() { return m_hWnd; }

private:
	HWND m_hWnd;
	HINSTANCE m_hIMEdll;
	UINT m_uiAnsiCodePage;
	UINT m_uiDeviceCodePage;

	BYTE m_abCompStringAttr[MAX_COMPSTRING_SIZE];

	CEditBox* m_pEditBox;
};
